home *** CD-ROM | disk | FTP | other *** search
-
- STYLES: A simple application of Pattern Programming using REPLACE 1.00
-
- Replace 1.00: Copyright (C) 1991 Michael Houlder
-
-
- 1. Purpose
- ==========
- STYLES is a simple filter application which "extends the DDE" in the sense described by
- Acorn's documentation for the Desktop Development Environment.
-
- The DDE environment for the application allows the filter to multi-task with any other
- desktop application, in particular IMPRESSION.
-
- It is of use sometimes to list all the Impression styles that have been actually used for
- one particular "text story"; i.e. distinct from just those that are defined for the
- document. Impression lists these latter perfectly adequately.
-
- Having selected a particular text story in Impression, if the "Save text story" dialogue
- 'save' icon is dragged to the iconbar !Styles icon, then a list of the styles used will
- be displayed. This assumes that the default choice of "With Styles" has not been changed.
-
- Rather than use the relatively lengthy "Save Text Story" dialogue, the direct CONTROL-SHIFT-T
- keystroke makes the 'save' icon available immediately for dragging to !Styles.
-
- Alternatively, the text story 'save' icon may be dragged to a filer directory window where
- it causes the creation of a permanent file. The corresponding filer icon may be dragged in
- turn to !Styles to create the style listing.
-
-
- 2. References
- =============
- (a) The DDE format !help files contained in the two applications associated with this
- documentation: !Replace and !Styles.
-
- (b) The 3 parts of my article "Power Search: A Quiet AI Revolution" contained in Archive
- magazine, Vols 5.7, 5.8, 5.9 for April, May and June respectively.
-
- (c) The Acorn User Guide for the DDE.
-
- (d) Computer Concept's user guide for Impression 2.
-
-
- 3. Impression DDF
- =================
- Impression supports an alternative ASCII text format for its document data files. This is the
- Document Description Format (DDF). Graphics are not included, of course. The document text is
- held as ordinary text.
-
- The additional format and display applications and definitions are held in the form of an
- ASCII text language. Sentences from this language are embedded within the document text.
- The document text plus the embedded format & display language together make up the DDF.
-
- The grammar plus examples for the format & display definition language are given in the
- user guide for Impression 2, pp.254.
-
-
- 4. Operation
- ============
- In particular, examples of style application sentences are given: e.g. {"Bold" on}. In this
- example, from this point on in the document text until cancelled by {"Bold" off}, the document
- text will be displayed in the Bold style.
-
- By definition, the symbol '{' always introduces sentences from the display & definition
- language. Any occurrences within the document text are suppressed.
-
- Hence, any application or cancellation of any style is the symbol '{' followed by a quoted
- string. If all these instances are found by pattern matching, then all styles used have been
- identified.
-
- If everything else in the text story is deleted, then the list left behind includes all
- styles used.
-
- However, the list also includes unwanted duplications. Another filter supplied as part of the DDE,
- COMMON, has the ability to list just one copy of each word in a text file. If COMMON is applied
- to the partially text story, then COMMON will produce a list of styles; each style listed just once.
-
- If REPLACE is used once more to delete unwanted statistics etc from the COMMON output, then the
- desired result is achieved
-
-
- 5. Limitations of COMMON
- ========================
- COMMON suffers from one limitation which causes problems in this application. The characters
- that COMMON uses to identify the ends of words are not user-definable. Any character that is not
- alphanumeric is defined to separate words
-
- For our application, we need a much reduced range of separators: just newline (linefeed).
- Impression allows style names such as "Main Heading" and "Sub-heading". COMMON thinks these two
- strings represent 4 words, and hence we have 4 separate styles.
-
- The solution, short of writing a new version of COMMON, is to insert, using REPLACE, unused
- character combinations in place of these non-alphanumeric characters which can in turn be replaced
- when COMMON has done its work.
-
-
- 6. Application Structure
- ========================
- The DDE interface, !Styles calls an Obey file, "ObeyFile". This has five commands:
-
- Call 1 to REPLACE : using pattern program "prog11", this deletes everything in the supplied
- text story except the names from style applications and cancelations. It also
- replaces within these names any character COMMON will think of as a word
- separator.
-
- Call to COMMON : this produces a list of style names with duplicates suppressed, together
- with some unwanted statistics.
-
- Call 2 to REPLACE : using pattern program "prog22", this deletes the unwanted
- statistics. It also replaces the non-alphanumeric characters that are part of
- the style names found.
-
- Type : this displays the style name list with the output appearing in the DDE display
- window.
-
- Wipe : this deletes the working files which are no longer needed.
-